﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace WebApiFramework
{
    public class EncryptUtils
    {
        public string GetCode()
        {
            HMACSHA1 hmacsha1 = new HMACSHA1();
            hmacsha1.Key = Encoding.UTF8.GetBytes("Kevin");
            byte[] dataBuffer = Encoding.UTF8.GetBytes("123456"); 
            byte[] hashBytes = hmacsha1.ComputeHash(dataBuffer);
            return Convert.ToBase64String(hashBytes);
         
        }


        //js
        // CryptoJS.HmacSHA1(string,key)  
        //var sign = CryptoJS.HmacSHA1('123456', 'Kevin');
        //alert(  CryptoJS.enc.Base64.stringify(sign));
        //console.log(sign)

        //hmac-sha1.js
        //enc-base64.js
 

    }
}
